from backend.controller import common, teacher, student, admin
from backend.config import get_config
from fastapi.staticfiles import StaticFiles
from backend.library.auth import global_filter
from fastapi import Security


def register_router(app):
    """
    注册系统路由
    """
    config = get_config()

    #注册API路由
    app.include_router(common.router)
    # 管理员接口入口
    app.include_router(admin.router, dependencies=[Security(global_filter,scopes=['admin'])])
    # 教师接口入口
    app.include_router(teacher.router, dependencies=[Security(global_filter,scopes=['teacher'])])
    # 学生接口入口
    app.include_router(student.router, dependencies=[Security(global_filter,scopes=['student'])])

    #注册静态文件路由
    app.mount('/', StaticFiles(directory=config.root_path+"/frontend"), name="www")



    return True